#!/usr/bin/env python
#_*_coding:utf-8_*_
# =================================
# Author    : snakecy
# Date      : 2020/11/4 0004 17:51
# File      : main
# =================================


from fcmbci import FcmDataProcessor, FcmVisualize, FcmSimulator
fcm = FcmDataProcessor()

# fcm.read_xlsx('unittests/test_cases/sample_test.xlsx', 'Matrix')
fcm.read_xlsx('usedata.xlsx', 'Matrix')

data_mat = fcm.data
print(data_mat)

fcm.gen_weights_mat(data_mat)
weights = fcm.causal_weights
print(weights)

fcm.create_system(causal_weights=weights)

vis = FcmVisualize(fcm)
vis.system_view(fcm.system, target=['C1'])

init = {'C1' : 1, 'C2' : 1, 'C3' : 0, 'C4' : 0}

sim = FcmSimulator(init, fcm.causal_weights)

vis.simulation_view(sim.scenarios, 'initial_state', nxData=fcm.system, network_view =True)


sim.test_scenario('scenario_1', {'C1' : 0, 'C2' : 1}, fcm.causal_weights)
vis.simulation_view(sim.scenarios, 'scenario_1', nxData=fcm.system, network_view =True, target=['C1','C2'])